﻿/*
 Enter your code here. Read input from STDIN. Print output to STDOUT
 Your class should be named Solution
*/
using System;
using System.Collections.Generic;

namespace UnfriendlyNumbers
{
  public class Solution
  {
    private static long[] FactoryDividers(long number)
    {
      var list = new List<long>();

      long old = 0;
      long max = (long)Math.Floor(Math.Sqrt((double)number));

      for (long div = max; div >= 1; div--)
      {
        if (number % div == 0)
        {
          if (old != div)
          {
            list.Add(div);
            old = div;
          }
          var num = number / div;
          if (old != num)
          {
            list.Add(num);
            old = num;
          }
        }
      }

      return list.ToArray();
    }

    private static long[] FactoryNumbers(IEnumerable<char> numbersString, ref long n)
    {
      long returnsIdx = 0;
      var returns = new long[n];
      long num = 0;

      foreach (var nP in numbersString)
      {
        switch (nP)
        {
          case '0': num *= 10; num += 0; break;
          case '1': num *= 10; num += 1; break;
          case '2': num *= 10; num += 2; break;
          case '3': num *= 10; num += 3; break;
          case '4': num *= 10; num += 4; break;
          case '5': num *= 10; num += 5; break;
          case '6': num *= 10; num += 6; break;
          case '7': num *= 10; num += 7; break;
          case '8': num *= 10; num += 8; break;
          case '9': num *= 10; num += 9; break;
          case ' ': returns[returnsIdx] = num;
                    returnsIdx++;
                    if (returnsIdx == n) Array.Resize<long>(ref returns, (int)(++n));
                    num = 0; break;
        }
      }
      returns[returnsIdx] = num;

      return returns;
    }

    public static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        long n = Convert.ToInt64(input[0]);
        long number = Convert.ToInt64(input[1]);

        long[] factors = FactoryDividers(n);
        input = Console.ReadLine().Split(' ');
        int count = 0;
        long inputNo;
        foreach (var s in factors)
        {
            bool ok = true;
            for (int i = 0; i < input.Length; i++)
            {
                inputNo = Convert.ToInt64(input[i]);
                
                if (s % inputNo == 0)
                {
                    ok = false;
                    break;
                }

               

            }
            if (ok)
                count = count + 1;

        }
        
        

        Console.WriteLine(count);

    }
  }
}